/*
 * @Author: wang cong wangc9832@163.com
 * @Date: 2023-12-19 15:48:44
 * @LastEditors: wang cong wangc9832@163.com
 * @LastEditTime: 2023-12-20 11:13:04
 * @FilePath: /ams_kt_front/src/api/operation/otherContracts.ts
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 */
import { BasicFetchResult } from '../model/baseModel';
import { defHttp } from '@/utils/http/axios';
import { downloadBlob } from '@/utils/file/download';
const api = '/amsOtherConstract';
// 查详情
export const detail = (id?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: api + '/detail/'+id  });
// 分页
export const page = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: api + '/page', params });
// 新增
export const add = (params?: any) =>
  defHttp.post({ url: api + '/add', params });
// 编辑
export const edit = (params?: any) =>
  defHttp.post({ url: api + '/edit', params });
// 删除
export const del = (ids: string[]) =>
  defHttp.post({ url: api + '/delete', params: ids });
// 导出
export const exp = (params?: any) => {
  return new Promise<void>((resolve, reject) => {
    defHttp
      .get(
        { responseType: 'blob', url: api + '/export', params },
        { isReturnNativeResponse: true }
      )
      .then((res) => {
        downloadBlob(res);
        resolve();
      })
      .catch(() => {
        reject();
      });
  });
};
